
<template src="./tpl.html">


        
</template>

<script>
import { CONSENT_GET_FS_LIST,CONSENT_GET_FJ_LIST} from "_SERVICES/api";
import { trimAll } from "UTILS/string";
import { isvalidateNum2 } from "UTILS/validate";
import { timeFormatter } from "UTILS/format";
import { setStorage,getStorage } from "UTILS/util";




import page from "@/modules/CST/mxins/page";
export default {
  name: "fsk_list",
  mixins: [page],
  data() {
    return {
      pickerOptions: {
        shortcuts: [{
          text: '最近一周',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近一个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
            picker.$emit('pick', [start, end]);
          }
        }, {
          text: '最近三个月',
          onClick(picker) {
            const end = new Date();
            const start = new Date();
            start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
            picker.$emit('pick', [start, end]);
          }
        }]
      },
      formInline: {
        YYSJ:[timeFormatter(new Date(),2),timeFormatter(new Date(),2)],
        ZYH:"",
        BRBH:"",
        BRXM:"",
        FJMC:""
      },
      FJ_LIST:[],
      card_obj:{},
    
      headers: [
        {
          label: "就诊卡号",
          prop: "BRBH",
        },
        {
          label: "住院号",
          prop: "ZYH",
        },
        {
          label: "体检编号",
          prop: "TJBH",
        },
        {
          label: "患者姓名",
          prop: "BRXM",
        },
        {
          label: "性别",
          prop: "BRXB_STR",
          width:60
        },
        {
          label: "检查号",
          prop: "JCH",
        },
        {
          label: "检查项目",
          prop: "JCBW",
        },
        {
          label: "开单科室",
          prop: "SQZKMC",
        },
        {
          label: "联系方式",
          prop: "LXDH",
        },
        {
          label: "状态",
          prop: "ZTBZ_STR",
        },
        {
          label: "房间",
          prop: "FJMC",
        },
      ],
    };
  },
  created() {
    if(this.$route.query && this.$route.query.BRBH){
      this.formInline.BRBH = this.$route.query.BRBH
    }else{
      if(getStorage("FSK_LIST_FJMC")){
        this.formInline.FJMC = getStorage("FSK_LIST_FJMC")
      }
    }

    this.get_fj_list();
    this.getList();

    
  },
  mounted() {},
  methods: {
    resetForm(name) {
      this.$refs[name].resetFields();
      this.$refs.ybCard.clear();
      this.card_obj = {}
      // this.search();
    },
   
    getList() {

      this.listLoading = true;
      let params = {
        ...this.formInline,
        BSLX: this.card_obj.BSLX || "",//BSLX
        WYBS: this.card_obj.WYBS || "",//WYBS
      };

      if (params.WYBS) {
        params = {
          YYSJ: params.YYSJ,
          BSLX: params.BSLX,
          WYBS: params.WYBS,
          insuplc_admdvs:this.card_obj.insuplc_admdvs
        }
      }


      Object.assign(params, this.getParams());

      setStorage({
        name:"FSK_LIST_FJMC",
        value:this.formInline.FJMC
      })

      return CONSENT_GET_FS_LIST(params)
        .then((res) => {
          this.listLoading = false;
          this.listQuery.totalNum = res.data.totalNum;
          this.tableData = res.data.list;
          this.CONSENT_GET_CURRENT_VERSION();//检查版本

        })
        .catch((res) => {
          this.listLoading = false;
          this.downloadLoading = false;
      });
    },
    get_fj_list() {
      CONSENT_GET_FJ_LIST({}).then((res) => {
        console.log("获取房间列表成功");
        this.FJ_LIST = res.data || [];
      });
    },
    //刷卡只受预约时间的约束
    back(obj){
      if(obj.code==0){
        this.card_obj = obj;
        this.search();
      }else{
        this.card_obj = {}
        if(obj.msg) {
          this.$message.error(obj.msg)
        }
      }
     
    },
    rowClick(row){
      console.log(row)
      this.$router.push({
        path:"/consentList",
        query:{
          fromPage:"PATIENT_LIST",
          BRBH: row.BRBH,
          BRXM: row.BRXM,
          GET_PATIENT_BY_PRIMARY: row.JCH,
          GET_PATIENT_TYPE:"FSZX",
        }
       
      })
    }
  },
};
</script>

<style lang="less">

</style>
